var t = require("../../../../@babel/runtime/helpers/typeof"), a = require("../../../../@babel/runtime/helpers/defineProperty"), e = getApp();

Component({
    properties: {
        show: {
            type: Boolean,
            value: !1
        },
        hasCompany: {
            type: Boolean,
            value: !1
        },
        real_name_auth_set: {
            type: Object,
            value: {}
        }
    },
    observers: {
        show: function(t, a) {
            this.setData({
                showPersonBank: t
            });
        }
    },
    data: {
        showPersonBank: !1,
        activeName: "1",
        form: {
            name: "",
            id_no: "",
            tel: "",
            face_auth_mode: ""
        },
        authcode: "",
        bank_no: "",
        flow_id: "",
        count: "",
        timer: null
    },
    methods: {
        handlerInput: function(t) {
            var e = t.target.dataset.type;
            this.setData(a({}, "".concat(e), t.detail));
        },
        sureIdentify: function() {
            var t = this;
            if (2 != this.data.activeName || this.data.bank_no) if (this.data.form.tel) {
                var s = "", n = {};
                1 == this.data.activeName ? (s = e.getNetAddresss("plugin.yun-sign.frontend.h5.person.auth-tel-v2"), 
                n = this.data.form) : 2 == this.data.activeName && (s = e.getNetAddresss("plugin.yun-sign.frontend.h5.person.auth-bank-card-v2"), 
                this.setData(a({}, "form.bank_no", this.data.bank_no)), n = this.data.form), e._postNetWork({
                    url: s,
                    data: n,
                    success: function(a) {
                        if (t.data.timer = null, 1 === a.data.result) {
                            var s = a.data;
                            e.tips("已发送"), t.setData({
                                flow_id: s.data.data.flowId
                            }), t.data.timer || (t.countDown = 60, t.data.timer = setInterval(function() {
                                t.countDown > 0 && t.countDown <= 60 ? t.setData({
                                    count: --t.countDown
                                }) : (clearInterval(t.data.timer), that.data.timer = null);
                            }, 1e3));
                        } else wx.showModal({
                            title: "提示",
                            content: a.data.msg,
                            showCancel: !1
                        });
                    }
                });
            } else e.tips("请先填写手机号"); else e.tips("请先填写银行卡");
        },
        sendCode: function() {
            if (2 != this.data.activeName || this.data.bank_no) if (3 == this.data.activeName || this.data.flow_id) {
                if (console.log(this.data.authcode), 3 == this.data.activeName || this.data.authcode) return 3 != this.data.activeName || this.data.form.face_auth_mode ? void this.sendAuthRequest() : (console.log(t(this.data.activeName), this.data.form), 
                void e.tips("请先选择识别方式"));
                e.tips("请先填写验证码");
            } else e.tips("请先获取验证码"); else e.tips("请先填写银行卡");
        },
        sendAuthRequest: function() {
            var t = this, a = "", s = {};
            1 == this.data.activeName ? (a = e.getNetAddresss("plugin.yun-sign.frontend.person.check-tel-sms-code"), 
            s = {
                flow_id: this.data.flow_id,
                authcode: this.data.authcode
            }) : 2 == this.data.activeName ? (a = e.getNetAddresss("plugin.yun-sign.frontend.person.check-bank-sms-code"), 
            s = {
                flow_id: this.data.flow_id,
                authcode: this.data.authcode
            }) : (a = e.getNetAddresss("plugin.yun-sign.frontend.h5.person.auth-face-v2"), s = {
                name: this.data.form.name,
                id_no: this.data.form.id_no,
                tel: this.data.form.tel,
                face_auth_mode: this.data.form.face_auth_mode,
                callback_url: ""
            }), e._postNetWork({
                url: a,
                data: s,
                success: function(a) {
                    var s = a.data;
                    1 === s.result ? (e.tips(s.msg), t.triggerEvent("update"), t.hiddenPop()) : wx.showModal({
                        title: "提示",
                        content: a.data.msg,
                        showCancel: !1
                    });
                },
                fail: function(t) {
                    e.tips(t.msg);
                }
            });
        },
        hiddenPop: function() {
            this.setData({
                showPersonBank: !1
            });
        }
    }
});